<template>
  <div>
    <!-- 遍历提前制定好的规则数据 -->
    <template v-for="(i, index) in curTableData.priceInfo">
      <div v-if="!i.with" :key="index" class="medium-data-item">
        <span class="title">{{ i.label }}:</span>
        <span v-if="priceInfo[i.key]" class="name keep-all">¥{{ priceInfo[i.key] | priceFormat(2, true) }}</span>
        <span v-else class="name keep-all">--</span>
      </div>
    </template>
    <!-- 附加条件 -->
    <div class="with-price">
      <template v-for="(i, index) in curTableData.priceInfo">
        <div v-if="i.with" :key="index" class="medium-data-item dash-line">
          <span class="title">{{ i.label }}:</span>
          <span v-if="priceInfo[i.key]" class="name keep-all">¥{{ priceInfo[i.key] | priceFormat(2, true) }}</span>
          <span v-else class="name keep-all">--</span>
        </div>
      </template>
    </div>
  </div>
</template>

<script>
import { priceFormat } from '@/filters/number';
import { TableData } from '@/views/medium/mixin/mediumData';
export default {
  filters: { priceFormat },
  props: {
    activeTabs: {
      type: String,
      default: ''
    },
    priceInfo: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      TableData
    };
  },
  computed: {
    curTableData() {
      // 如果么有对应的 activeTabs 数据，则使用更多tab的数据 this.TableData['5']
      return this.TableData[this.activeTabs] || this.TableData['5'];
    }
  }
};
</script>
<style lang="scss" scoped>

</style>
